<?php
class Admin_Form_Menu extends Zend_Form
{
   public function init()
    {
       	$this->setAction ( '' )
          	->setMethod ( 'post' );
      
      	// Create and configure username element:
      	$parent = $this->createElement ( 'select', 'parent');
      	$parent->setLabel('Danh mục gốc:')
      			->addMultiOptions(array('' => 'Danh mục gốc'));
      
      	// Create and configure password element:
      	$name_menu= $this->createElement ( 'text', 'name' );
      	$name_menu->addValidator ( 'StringLength', false, array (1 , 40) )
            	->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->setAttrib('size',50)
				->addValidator('NotEmpty')
            	->setLabel('Tên danh mục');
            
      	$description= $this->createElement ( 'textarea', 'desc', array('label' => 'Giới thiệu danh mục:', 'rows' => '10', 'cols'=>'70') );
      	$description->setRequired(true)
					->addFilter('StripTags')
					->addFilter('StringTrim')
					->addValidator('NotEmpty');
        $keywords= $this->createElement ( 'text', 'keywords' );  
		$keywords->addValidator ( 'StringLength', false, array (1 , 250) )
	            ->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->setAttrib('size',50)
				->addValidator('NotEmpty')
	            ->setLabel('Từ khóa');
      	$order = $this->createElement('text', 'order');
      	$order->setLabel('Số thứ tự:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->addFilter('Int')
				->setAttrib('size',10)
				->addValidator('NotEmpty');
				
	  	$status = $this->createElement('checkbox','active',array('label' => 'Sử dụng:','checkedValue' => 1,'uncheckedValue' => 0));
	  	$status->setValue(1);
	  
      	$submit = $this->createElement('submit', 'submit');
      	$submit->setAttrib('id', 'submit');
      	$submit->setLabel('Submit');
      	$submit->setAttrib('class', 'formbutton');   
      	$submit->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'hb') ,array('Label', array('tag' => '')))));      
      	$reset = $this->createElement('reset','reset',array ('label' => 'Làm lại'));          
      	$reset->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'hb') ,array('Label', array('tag' => '')))));      
      	$reset->setAttrib('class', 'formbutton');   
      	$cancel = $this->createElement('button','back',array ('label' => 'Quay lại'));
      	$cancel->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'hb') ,array('Label', array('tag' => '')))));
      	$cancel->setAttrib('class', 'formbutton');     
      	// Add elements to form:
      	$this->addElement ( $parent )
	          ->addElement ( $name_menu ) 
	          ->addElement($description)
	          ->addElement($keywords) 
	          ->addElement ( $order ) 
	          ->addElement ( $status ) 
	          ->addElement($submit)
	          ->addElement($reset)
	          ->addElement($cancel);
    }
}